<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>2025国庆倒计时</title>
<style>
body{display:flex;height:100vh;margin:0;align-items:center;justify-content:center;background:#f0f0f0;font-family:Arial,Helvetica,sans-serif}
.box{border:2px solid #000;padding:40px 60px;background:#fff;text-align:center}
.title{font-size:25px;margin-bottom:20px}
.count{font-size:60px;font-weight:bold}
</style>
</head>
<body>
<div class="box">
  <div class="title">距离2025年国庆节放假倒计时</div>
  <div class="count" id="cd">加载中…</div>
</div>

<script>
/* ====== 颜色表 ====== */
function colorOf(s){          // s = 剩余秒数
  if(s<=0)           return "#FF00FF";   // 0秒 粉
  if(s<=1)           return "#FF0000";   // 1秒 红
  if(s<=10)          return "#FF4000";   // 10秒 朱红
  if(s<=60)          return "#F07000";   // 60秒 橙
  if(s<=600)         return "#959500";   // 10分钟 土黄
  if(s<=1800)        return "#00A000";   // 30分钟 森绿
  if(s<=3600)        return "#00D0FF";   // 60分钟 深绿蓝
  if(s<=7200)        return "#8000FF";   // 2小时 紫
  if(s<=14400)       return "#400080";   // 4小时 深紫
  if(s<=21600)       return "#000000";   // 6小时 黑
  return "#000000";                      // >6小时 黑
}

/* ====== 主定时器 ====== */
function tick(){
  const t = new Date("2025-10-01T00:00:00") - new Date();
  const s = Math.max(0, Math.floor(t/1000));

  const d = Math.floor(s/86400);
  const h = Math.floor((s%86400)/3600);
  const m = Math.floor((s%3600)/60);
  const sec = s%60;

  const str = `-${String(d).padStart(3,'0')}:${String(h).padStart(2,'0')}:${String(m).padStart(2,'0')}:${String(sec).padStart(2,'0')}`;
  const el = document.getElementById('cd');
  el.textContent = str;
  el.style.color = colorOf(s);
}
tick();
setInterval(tick,1000);
</script>
</body>
</html>
